 <template>
    <div class="result_panel">
       <div class="result_icon">
         <img v-if="resultData.status == 'success'" src="~@/assets/imgs/common/success_icon.png" alt="">
         <img v-if="resultData.status == 'fail'" src="~@/assets/imgs/common/fail_icon.png" alt="">
         <img v-if="resultData.status == 'waiting'" src="~@/assets/imgs/common/waiting_icon.png" alt="">

       </div>
       <div class="result_text">
         <span class="text_content">{{resultData.text}}</span>
       </div>
       <div class="result_explain" v-if="resultData.subText">
         <span class="explain_content">{{resultData.subText}}</span>
       </div>
       <div class="btns_block">
         <div class="left" v-if="resultData.btns[0]">
             <span class="btn btn_green_outline" @click="handlerBtnCb(0)">{{resultData.btns[0].text}}</span>
         </div>
         <div class="center" v-if="resultData.btns[1]"></div>
         <div class="right" v-if="resultData.btns[1]">
           <span class="btn btn_green" @click="handlerBtnCb(1)" v-lockClick>{{resultData.btns[1].text}}</span>
         </div>
       </div>
    </div>
</template>

<script>
import {mapState,mapActions} from 'vuex';
export default {
  props: {
    resultData:{
      type:Object,
      required:true
    }
  },
  components:{
    
  },
  data() {
    return {
      
    }
  },
  computed: mapState({
   
  }),

  mounted() {
    
  },

  methods: {
    ...mapActions(['toggleLoading','showMsg','showModal']),
    handlerBtnCb(i){

      let btn = this.resultData.btns[i];
      if(btn && btn.cb){
        if(typeof btn.cb == 'function'){
            btn.cb();
        }
      }

    }
  }
}
</script>

<style lang="less" scoped>
  .result_panel{
    padding:0.4rem 0.5rem 0.6rem 0.5rem;
    background-color: #fff;
    .result_icon{
      display: flex;
      justify-content: center;
      img{
        width: 1.5rem;
        height: 1.5rem;
      }
    }
    .result_text{
      margin-top: 0.2rem;
      text-align: center;
      .text_content{
        font-size: 0.36rem;
        line-height: 0.44rem;
        color: #333;
      }
    }
    .result_explain{
      margin-top: 0.18rem;
      text-align: center;
      .explain_content{
        font-size: 0.28rem;
        color: #999;
        line-height: 0.36rem;
      }
    }
    .btns_block{
      margin-top: 0.6rem;
      display: flex;
      .left{
        flex: 1;
      }
      .center{
        width: 0.5rem;
      }
      .right{
         flex: 1;
       
      }
    }
  }

</style>
